package cn.edu.neusoft.yuejian12.Model;

import java.util.List;

import cn.edu.neusoft.yuejian12.JavaBean.Train;
import cn.edu.neusoft.yuejian12.JavaBean.TrainInfo;
import cn.edu.neusoft.yuejian12.Service.TrainService;
import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by 木子李 on 2017/10/10.
 */

public class TrainModel {
    private Retrofit retrofit;;
    public TrainModel(){
        retrofit = new Retrofit.Builder()
                /*.baseUrl("http://172.24.10.130:8080/foodService/")*/
                .baseUrl("http://172.24.10.175/workout/api.php/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    public retrofit2.Call<List<Train>> gettrainlist(){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTrainList();
    }

    public retrofit2.Call<List<TrainInfo>> gettrainlists(){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.gettrainList();
    }

    public Call<TrainInfo> gettraininfo(String id){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTraininfo("lgj98rfkiqvenhrk2o7oe2po81","train",id);
    }
    public Call<List<TrainInfo>> gettraintype(String Degree){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getallTrain("lgj98rfkiqvenhrk2o7oe2po81","train",Degree);
    }
    public Call<Integer> applyTrain(String participantname,String train_id,String participanttel,String adultnum,String paytype,
                                   String pay,String paynotice,int userid){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.applyTrain("signtrain",participantname,train_id,participanttel,adultnum,paytype,pay,paynotice,userid,"lgj98rfkiqvenhrk2o7oe2po81");
    }
}
